#ifndef CONVERSE_VOICEMESSAGE_H
#define CONVERSE_VOICEMESSAGE_H

#include "converseabstractmessage.h"

#include <QByteArray>
#include <QObject>


namespace Converse {

class AbstractConversation;
class AbstractMessage;

class VoiceMessage : public Converse::AbstractMessage
{
    Q_OBJECT
public:
    explicit VoiceMessage(qint64 id,
                          qint64 sendingId,
                          const AbstractConversation &conversation,
                          qint64 createdTime,
                          qint64 receivedTime,
                          int32_t  senderId,
                          qint64 receiverId,
                          const QString &voiceUrl,
                          QObject *parent = 0);

    virtual ~VoiceMessage();

private:
    QString m_url;
    QString m_textMessage;
    QByteArray m_data;
    QString m_format;
    QString m_voiceId;
    QString m_tempFile;
    bool m_isAccepted;
    bool m_isRejected;
    bool m_isCancel;

public:
    inline const QString &url() const {
        return m_url;
    }

    inline const QString &textMessage() const {
        return m_textMessage;
    }

    inline QByteArray voice() const {
        return m_data;
    }

    inline void setVoice(QByteArray data) {
        m_data = data;
    }

    inline QString fomat() {
        return m_format;
    }

    inline void setFomat(const QString &format) {
        m_format = format;
    }

    inline const QString &voiceId() const {
        return m_voiceId;
    }

    inline void setVoiceId(const QString &voiceId) {
        m_voiceId = voiceId;
    }

    inline void setAcceptedState(bool state) {
        m_isAccepted = state;
    }

    inline bool isAccepted() const {
        return m_isAccepted;
    }

    inline void setRejectState(bool state) {
        m_isRejected = state;
    }

    inline bool isRejected() const {
        return m_isRejected;
    }

    inline void setCancelState(bool state) {
        m_isCancel = state;
    }

    inline bool isCancel() const {
        return m_isCancel;
    }

    inline void setTempFile(const QString &path) {
        m_tempFile = path;
    }

    inline const QString &tempFile() const {
        return m_tempFile;
    }

public:
    void setAcceptedState();
    void setRejectState();
    void setCancelState();

public:
    const QString &message() const;
    AbstractMessage::Type type() const;
    QVariant extra() const;

};

} // namespace Converse

#endif // CONVERSE_VOICEMESSAGE_H
